<template>
  <div>
    <!-- 搜索栏 -->
    <el-form :inline="true" :model="formInline" class="demo-form-inline">
      <el-form-item label="学号">
        <el-input v-model="formInline.user" placeholder="学号"></el-input>
      </el-form-item>
      <el-form-item label="专业">
        <el-select v-model="formInline.region" placeholder="专业">
          <el-option label="软件工程" value="软件工程"></el-option>
          <el-option label="网络工程" value="网络工程"></el-option>
          <el-option label="信息工程" value="信息工程"></el-option>
          <el-option
            label="计算机科学与技术"
            value="计算机科学与技术"
          ></el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="onSubmit">查询</el-button>
      </el-form-item>
    </el-form>

    <!-- 表格区域 -->
    <el-table :data="tableData" style="width: 100%">
      <el-table-column prop="student_name" label="姓名" width="120">
      </el-table-column>
      <el-table-column prop="article_studentId" label="学号" width="180">
      </el-table-column>
      <el-table-column prop="student_class" label="专业" width="120">
      </el-table-column>
      <el-table-column prop="article_teacherscore" label="教师成绩" width="120">
      </el-table-column>
      <el-table-column
        prop="look_teacherScore"
        label="评阅教师成绩"
        width="120"
      >
      </el-table-column>
      <el-table-column prop="reply_score" label="答辩小组成绩" width="180">
      </el-table-column>
      <el-table-column prop="allScore" label="最终成绩"></el-table-column>
    </el-table>

    <!-- 分页区域 -->
    <el-pagination
      background
      layout="prev, pager, next"
      :page-size="queryinfo.pageSize"
      :current-page="queryinfo.current"
      :total="total"
      :hide-on-single-page="page"
    >
    </el-pagination>
  </div>
</template>
<script>
export default {
  created() {
    this.getAll_scrore();
  },
  data() {
    return {
      total: null,
      page: true,
      queryinfo: {
        pageSize: 5,
        current: 1,
      },
      formInline: {},
      tableData: [],
    };
  },
  methods: {
    getAll_scrore() {
      const info = { ...this.formInline, ...this.queryinfo };
      this.$http
        .get("http://127.0.0.1:8080/minAdmin/student_score", { params: info })
        .then((res) => {
          if (res.data.status == 0) {
            this.tableData = res.data.data.datalist;
            this.total = res.data.data.total;
          } else {
            this.$message.error(res.data.message);
          }
          // console.log(res);
        })
        .catch((err) => {
          this.$message.error(err);
        });
    },
    onSubmit() {
      this.getAll_scrore();
    },
  },
};
</script>
<style lang="less" scoped>
.el-pagination {
  position: fixed;
  top: 70%;
  left: 50%;
  transform: translate(-50%, 0);
}
</style>
